# Maintainer: David Runge <dave@sleepmap.de>

pkgname=wolf-spectrum
pkgver=1.0.0
pkgrel=2
pkgdesc="A spectrogram plugin"
arch=('loong64' 'x86_64')
url="https://github.com/pdesaulniers/wolf-spectrum"
license=('GPL3')
groups=('lv2-plugins' 'pro-audio' 'vst-plugins')
depends=('jack' 'libglvnd')
makedepends=('gendesk' 'lv2')
source=("https://github.com/pdesaulniers/${pkgname}/releases/download/v${pkgver}/${pkgname}-v${pkgver}-source.tar.gz")
sha512sums=('e84abfef3a08d8da8fe5350088f43d7670c5ff828ec7bf7ddcd4b3c19c1cdba6560be7b69ab5b9af1d27c80c195f123e635d2337e0a297282564935d54b8d501')

prepare() {
  mv -v "$pkgname" "$pkgname-$pkgver"
  cd "$pkgname-$pkgver"
  # XDG desktop file
  gendesk -n \
          --pkgname ${pkgname} \
          --pkgdesc "${pkgdesc}" \
          --categories "AudioVideo;Audio"
}

build() {
  cd "$pkgname-$pkgver"
  BUILD_VST2=true BUILD_LV2=true BUILD_JACK=true make
}

package() {
  cd "$pkgname-$pkgver"
  install -vDm 755 "bin/${pkgname}" -t "${pkgdir}/usr/bin/"
  install -vDm 644 "${pkgname}.desktop" \
    -t "${pkgdir}/usr/share/applications"
  install -vDm 755 "bin/${pkgname}-vst.so" -t "${pkgdir}/usr/lib/vst"
  install -vDm 755 "bin/${pkgname}.lv2/"*.so \
    -t "${pkgdir}/usr/lib/lv2/${pkgname}.lv2"
  install -vDm 644 "bin/${pkgname}.lv2/"*.ttl \
    -t "${pkgdir}/usr/lib/lv2/${pkgname}.lv2"
  install -vDm 644 README.md -t "${pkgdir}/usr/share/doc/${pkgname}"
}
